<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
class HomeController extends Controller
{
    //首页显示
    public function index()
    {
    	$data=DB::table('article')->get();
        foreach ($data as $key => $value) {
            $data[$key]->name=DB::table('cate')->where('id',$value->cate_id)->value('name');
        }
    	return view('home.index',['data'=>$data]);
    }

    //截图列表显示
    public  function getScre()
    {
        $scre=DB::table('scrshot')->where('pid','0')->get();
        $data=array();
        // var_dump($scre);die;
        return  view('home.scre',['data'=>$data,'scre'=>$scre]);
    }


    // 标签云
    public function getTag()
    {
    	$data=DB::table('article')->join('cate','article.cate_id','=','cate.id')->get();
    	return view('home.tag',['data'=>$data]);
    }
}
